﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using CBMS.Common;
using CBMS.Interfaces;
using CBMS.Objects;
using CBMS.Business;
using CBMS.Resources;
using CBMS.View;
using CBMS.Models;
namespace CBMS
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            frmLogin frm = new frmLogin(true);
            frm.StartPosition = FormStartPosition.CenterScreen;
            Application.Run(frm);           
            if (frm != null && frm.DialogResult == DialogResult.OK)
            {
                IStaffRepository staffRes = new StaffRepository();
                Staff objStaff = staffRes.GetByUserName(frm.userLogin);
                frmMain frmMain = new CBMS.frmMain();
                frmMain.userLogin = objStaff.user_name;
                frmMain.userLoginRole = objStaff.role_code;
                frmMain.userLoginBranch = objStaff.branch_id;
                frmMain.userLoginId = objStaff.staff_id;
                Application.Run(frmMain);
            }
          //  frm.Hide();
        }
    }
}
